package com.sl.au.repository;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.sl.au.entity.ArchiveInfo;

public interface ArchiveInfoRepository extends JpaRepository<ArchiveInfo, String> {

	@Query("select a from ArchiveInfo a where a.memo like %?1% or a.content like %?1% or a.register.registerEventName like %?1%")
	Page<ArchiveInfo> getArchivePageByKey(String key, Pageable pageable);

	@Query("select a from ArchiveInfo a")
	Page<ArchiveInfo> getArchivePage(Pageable pageable);

	@Query("select a from ArchiveInfo a where a.register.id=?1")
	List<ArchiveInfo> findArchiveByRegisterId(String eventId);

	@Query("select a from ArchiveInfo a where a.register.id=?1")
	ArchiveInfo findOneArchiveByRegisterId(String eventId);
}
